package com.yujing.yview

import android.app.Activity
import androidx.core.content.ContextCompat
import com.yujing.yview.base.YBaseDialog
import com.yujing.yview.databinding.DialogTestBinding

class TestDialog(activity: Activity) : YBaseDialog<DialogTestBinding>(activity!!, R.layout.dialog_test) {
    //初始化完成
    var initCompleteListener: ((DialogTestBinding) -> Unit)? = null

    init {
        fullscreen = true
        widthPixels = 0.4F
        heightPixels = 0.6F
        fillColor = ContextCompat.getColor(activity!!, R.color.fill_background)
    }

    override fun init() {
        binding.btConfirm.setOnClickListener { v ->
            show()
            dismiss()
        }
        binding.btCancel.setOnClickListener { v ->
            show()
            dismiss()
        }
        initCompleteListener?.invoke(binding)
    }

    init {
        widthPixels = 0.45f
        heightPixels = 0.8f
        fullscreen = true
        fillColor = ContextCompat.getColor(activity!!, R.color.fill_background)
    }
}